package cn.itlaobing.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itlaobing.entity.Student;
import cn.itlaobing.mapper.StudentMapper;
import cn.itlaobing.service.StudentService;

@Service
public class StudentServiceImpl implements StudentService {

	@Autowired
	private StudentMapper studentMapper;
	
	@Transactional
	@Override
	public Student save(Student student) {
		studentMapper.insert(student);
		return student;
	}

	@Transactional(readOnly=true)
	@Override
	public Student findById(Integer id) {
		Student student=studentMapper.selectByPrimaryKey(id);
		return student;
	}

}
